pub mod category;
pub mod dish;
pub mod employee;
pub mod setmeal;
use axum::{
    extract::DefaultBodyLimit,
    routing::{get, post, put},
    Router,
};
use category::category_router;
use dish::dish_router;
use employee::{employee_router, EmployeeApi};
use setmeal::setmeal_router;
use utoipa::OpenApi;
mod order;
use order::order_router;

use crate::{bootstrap::AppState, controller::admin::shop, controller::common::admin_file_upload};

#[derive(OpenApi)]
#[openapi(
    nest(
        (path = "/employee", api = EmployeeApi)
    )
)]
pub struct AdminApi {}

pub fn admin_router(state: &AppState) -> Router<AppState> {
    Router::new()
        .nest("/employee", employee_router(state.clone()))
        .nest("/category", category_router(state.clone()))
        .nest("/dish", dish_router(state.clone()))
        .nest("/setmeal", setmeal_router(state.clone()))
        .nest("/order", order_router(state.clone()))
        .route("/common/upload", post(admin_file_upload))
        .route("/shop/:status", put(shop::set_shop_status))
        .route("/shop/status", get(shop::get_shop_status))
        .layer(DefaultBodyLimit::disable())
}
